package smoker.tools;

import java.util.Calendar;

public class MyCalendar {
	private static MyCalendar myCalendar;
	
	private MyCalendar() {}
	
	public static MyCalendar getInstance() {
		if(myCalendar == null) {
			myCalendar = new MyCalendar();
		}
		return myCalendar;
	}
	
	public String myDateTime(char c1, char c2) {
		Calendar time = Calendar.getInstance();
		StringBuffer sb = new StringBuffer();
		int year = time.get(Calendar.YEAR);
		int month = time.get(Calendar.MONTH) + 1;
		int day = time.get(Calendar.DAY_OF_MONTH);
		int hour = time.get(Calendar.HOUR_OF_DAY);
		int minute = time.get(Calendar.MINUTE);
		int second = time.get(Calendar.SECOND);
		sb.append(" " + c1 + " ");
		sb.append(year).append("-");
		if(month < 10) {
			sb.append("0");
		}
		sb.append(month).append("-");
		if(day < 10) {
			sb.append("0");
		}
		sb.append(day).append(" ");
		if(hour < 10) {
			sb.append("0");
		}
		sb.append(hour + ":");
		if(minute < 10) {
			sb.append("0");
		}
		sb.append(minute + ":");
		if(second < 10) {
			sb.append("0");
		}
		sb.append(second + " " + c2 + " ");
		return sb.toString();
	}
}
